<?php echo $this->fetch('library/page_header.lbi'); ?>

<div id="page-content" class="single-page">
    <div class="container">
        <div class="row">
            <div class="col-lg-12">
                <ul class="breadcrumb">
                    <?php echo $this->fetch('library/ur_here.lbi'); ?>
                </ul>
            </div>
        </div>
        <div class="row">
            
            <div id="sidebar" class="col-md-4">
                <div class="widget wid-categories">
                    <div class="heading"><h4>类别</h4></div>
                    <div class="content">
                        <ul>
                            <?php $_from = $this->_var['categories']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'cat');if (count($_from)):
    foreach ($_from AS $this->_var['cat']):
?>

                            <li><a href="<?php echo $this->_var['cat']['url']; ?>"><?php echo htmlspecialchars($this->_var['cat']['name']); ?></a></li>
                            <?php $_from = $this->_var['cat']['cat_id']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'child');if (count($_from)):
    foreach ($_from AS $this->_var['child']):
?>
                            <li><a href="<?php echo $this->_var['child']['url']; ?>"><?php echo htmlspecialchars($this->_var['child']['name']); ?></a></li>
                            <?php $_from = $this->_var['child']['cat_id']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'childer');if (count($_from)):
    foreach ($_from AS $this->_var['childer']):
?>
                            <li><a href="<?php echo $this->_var['childer']['url']; ?>"><?php echo htmlspecialchars($this->_var['childer']['name']); ?></a></li>
                            <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                            <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                            <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?> 
                        </ul>
                    </div>
                </div>
               
                <div class="widget wid-product">
                    <div class="heading"><h4>浏览历史</h4></div>
                    <div class="content">
                        <div class="box" id='history_div'>
                            <div class="box_1">
                                <div class="boxCenterList clearfix" id='history_list'>
                                    <?php 
$k = array (
  'name' => 'history',
);
echo $this->_echash . $k['name'] . '|' . serialize($k) . $this->_echash;
?>
                                </div>
                            </div>
                        </div>
                        <div class="blank5"></div>
                        <script type="text/javascript">
                            if (document.getElementById('history_list').innerHTML.replace(/\s/g, '').length < 1)
                            {
                                document.getElementById('history_div').style.display = 'none';
                            } else
                            {
                                document.getElementById('history_div').style.display = 'block';
                            }
                            function clear_history()
                            {
                                Ajax.call('user.php', 'act=clear_history', clear_history_Response, 'GET', 'TEXT', 1, 1);
                            }
                            function clear_history_Response(res)
                            {
                                document.getElementById('history_list').innerHTML = '<?php echo $this->_var['lang']['no_history']; ?>';
                            }
                        </script>
                    </div>
                </div>
            </div>
            
            <div id="main-content" class="col-md-8">
                <div class="product">
                    <div class="col-md-6">
                        <a href="javascript:;" onclick="window.open('gallery.php?id=<?php echo $this->_var['goods']['goods_id']; ?>'); return false;">
                            <img src="<?php echo $this->_var['goods']['goods_img']; ?>" alt="<?php echo htmlspecialchars($this->_var['goods']['goods_name']); ?>"/>
                        </a>
                        <div class="col-md-12"></div>
                        <ul>
                            <?php $_from = $this->_var['pictures']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'picture');if (count($_from)):
    foreach ($_from AS $this->_var['picture']):
?>
                            <li class="col-lg-3 col-sm-3 col-xs-4"><a href="gallery.php?id=<?php echo $this->_var['id']; ?>&amp;img=<?php echo $this->_var['picture']['img_id']; ?>" target="_blank"><img src="<?php if ($this->_var['picture']['thumb_url']): ?><?php echo $this->_var['picture']['thumb_url']; ?><?php else: ?><?php echo $this->_var['picture']['img_url']; ?><?php endif; ?>" alt="<?php echo $this->_var['goods']['goods_name']; ?>" class="B_blue" /></a>
                            </li>
                            <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                        </ul>
                    </div>  

                    <div class="col-md-6">
                        <form action="javascript:addToCart(<?php echo $this->_var['goods']['goods_id']; ?>)" method="post" name="ECS_FORMBUY" id="ECS_FORMBUY" >
                            <div class="caption">
                                <div class="name"><h3><?php echo $this->_var['goods']['goods_style_name']; ?></h3></div>
                                <div class="info">
                                    <ul>
                                        <li>Brand: <?php echo $this->_var['goods']['goods_brand']; ?></li>
                                        <li>ID: 0122222</li>
                                    </ul>
                                </div>

                                <div class="price"><?php echo $this->_var['goods']['shop_price_formated']; ?><span><?php echo $this->_var['goods']['market_price']; ?></span></div>
                                <div class="info">

                                    <ul>

                                        <li class="clearfix">

                                        <dd class="ddR">
                                            <?php if ($this->_var['goods']['goods_number'] != "" && $this->_var['cfg']['show_goodsnumber']): ?>
                                            <?php if ($this->_var['goods']['goods_number'] == 0): ?>
                                            <strong><?php echo $this->_var['lang']['goods_number']; ?></strong>
                                            <font color='red'><?php echo $this->_var['lang']['stock_up']; ?></font>
                                            <?php else: ?>
                                            <strong><?php echo $this->_var['lang']['goods_number']; ?></strong>
                                            <?php echo $this->_var['goods']['goods_number']; ?> <?php echo $this->_var['goods']['measure_unit']; ?>
                                            <?php endif; ?>
                                            <?php endif; ?>
                                        </dd>
                                        </li>
                                        <li class="clearfix">
                                        <dd class="ddR">
                                            <strong><?php echo $this->_var['lang']['goods_weight']; ?></strong><?php echo $this->_var['goods']['goods_weight']; ?>
                                        </dd>
                                        </li>
                                        <?php if ($this->_var['goods']['is_promote'] && $this->_var['goods']['gmt_end_time']): ?>
                                        <?php echo $this->smarty_insert_scripts(array('files'=>'lefttime.js')); ?>
                                        <li class="padd loop" style="margin-bottom:5px; border-bottom:1px dashed #ccc;">
                                            <strong><?php echo $this->_var['lang']['promote_price']; ?></strong><font class="shop"><?php echo $this->_var['goods']['promote_price']; ?></font><br />
                                        </li>
                                        <?php endif; ?>
                                        
                                        <?php $_from = $this->_var['specification']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('spec_key', 'spec');if (count($_from)):
    foreach ($_from AS $this->_var['spec_key'] => $this->_var['spec']):
?>
                                        <li class="padd loop">
                                            <strong><?php echo $this->_var['spec']['name']; ?>:</strong><br />
                                            
                                            <?php if ($this->_var['spec']['attr_type'] == 1): ?>
                                            <?php if ($this->_var['cfg']['goodsattr_style'] == 1): ?>
                                            <?php $_from = $this->_var['spec']['values']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'value');if (count($_from)):
    foreach ($_from AS $this->_var['key'] => $this->_var['value']):
?>
                                            <label for="spec_value_<?php echo $this->_var['value']['id']; ?>">
                                                <input type="radio" name="spec_<?php echo $this->_var['spec_key']; ?>" value="<?php echo $this->_var['value']['id']; ?>" id="spec_value_<?php echo $this->_var['value']['id']; ?>" <?php if ($this->_var['key'] == 0): ?>checked<?php endif; ?> onclick="changePrice()" />
                                                       <?php echo $this->_var['value']['label']; ?> [<?php if ($this->_var['value']['price'] > 0): ?><?php echo $this->_var['lang']['plus']; ?><?php elseif ($this->_var['value']['price'] < 0): ?><?php echo $this->_var['lang']['minus']; ?><?php endif; ?> <?php echo $this->_var['value']['format_price']; ?>] </label><br />
                                            <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                                            <input type="hidden" name="spec_list" value="<?php echo $this->_var['key']; ?>" />
                                            <?php else: ?>
                                            <select name="spec_<?php echo $this->_var['spec_key']; ?>" onchange="changePrice()">
                                                <?php $_from = $this->_var['spec']['values']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'value');if (count($_from)):
    foreach ($_from AS $this->_var['key'] => $this->_var['value']):
?>
                                                <option label="<?php echo $this->_var['value']['label']; ?>" value="<?php echo $this->_var['value']['id']; ?>"><?php echo $this->_var['value']['label']; ?> <?php if ($this->_var['value']['price'] > 0): ?><?php echo $this->_var['lang']['plus']; ?><?php elseif ($this->_var['value']['price'] < 0): ?><?php echo $this->_var['lang']['minus']; ?><?php endif; ?><?php if ($this->_var['value']['price'] != 0): ?><?php echo $this->_var['value']['format_price']; ?><?php endif; ?></option>
                                                <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                                            </select>
                                            <input type="hidden" name="spec_list" value="<?php echo $this->_var['key']; ?>" />
                                            <?php endif; ?>
                                            <?php else: ?>
                                            <?php $_from = $this->_var['spec']['values']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('key', 'value');if (count($_from)):
    foreach ($_from AS $this->_var['key'] => $this->_var['value']):
?>
                                            <label for="spec_value_<?php echo $this->_var['value']['id']; ?>">
                                                <input type="checkbox" name="spec_<?php echo $this->_var['spec_key']; ?>" value="<?php echo $this->_var['value']['id']; ?>" id="spec_value_<?php echo $this->_var['value']['id']; ?>" onclick="changePrice()" />
                                                <?php echo $this->_var['value']['label']; ?> [<?php if ($this->_var['value']['price'] > 0): ?><?php echo $this->_var['lang']['plus']; ?><?php elseif ($this->_var['value']['price'] < 0): ?><?php echo $this->_var['lang']['minus']; ?><?php endif; ?> <?php echo $this->_var['value']['format_price']; ?>] </label><br />
                                            <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                                            <input type="hidden" name="spec_list" value="<?php echo $this->_var['key']; ?>" />
                                            <?php endif; ?>
                                        </li>
                                        <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                                        



                                </div>
                                <div class="rating"><span class="glyphicon glyphicon-star"></span><span class="glyphicon glyphicon-star"></span><span class="glyphicon glyphicon-star"></span><span class="glyphicon glyphicon-star"></span><span class="glyphicon glyphicon-star-empty"></span></div>
                                <div class="well"><label>Qty: </label> <input name="number" class="form-inline quantity" type="text" value="1" onblur="changePrice()"><a href="javascript:addToCart(<?php echo $this->_var['goods']['goods_id']; ?>)" class="btn btn-2 ">ADD</a></div>
                                <div class="share well">

                                    <strong style="margin-right: 13px;">Share :</strong>
                                    <a href="#" class="share-btn" target="_blank">
                                        <i class="fa fa-twitter"></i>
                                    </a>
                                    <a href="#" class="share-btn" target="_blank">
                                        <i class="fa fa-facebook"></i>
                                    </a>
                                    <a href="#" class="share-btn" target="_blank">
                                        <i class="fa fa-linkedin"></i>
                                    </a>
                                </div>
                            </div>
                            </ul>
                        </form>
                    </div>
                    <div class="clear"></div>
                </div>	
                <div class="product-desc">
                    <ul class="nav nav-tabs">
<!--                        <li class="active"><a href="#description">描述</a></li>
                        <li><a href="#review">评价</a></li>-->
                        <li id="li1" ><a href="javascript:fun()">描述</a></li>
                        <li id="li2"><a href="javascript:fn()">评价</a></li>
                    </ul>
                    <script>
                        function fn(){
                            document.getElementById('review').style.display = 'block';
                            document.getElementById('description').style.display = 'none';
                        }
                        function fun(){
                            document.getElementById('review').style.display = 'none';
                            document.getElementById('description').style.display = 'block';
                        }
                    </script>
                    <div class="tab-content">
                        <div id="description" class="tab-pane fade in active">
                            <?php echo $this->_var['goods']['goods_desc']; ?>
                            <h4>Sample Lorem Ipsum Text</h4>
                            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed at ante. Mauris eleifend, quam a vulputate dictum, massa quam dapibus leo, eget vulputate orci purus ut lorem. In fringilla mi in ligula. Pellentesque aliquam quam vel dolor. Nunc adipiscing. Sed quam odio, tempus ac, aliquam molestie, varius ac, tellus. Vestibulum ut nulla aliquam risus rutrum interdum. Pellentesque lorem. Curabitur sit amet erat quis risus feugiat viverra. Pellentesque augue justo, sagittis et, lacinia at, venenatis non, arcu. Nunc nec libero. In cursus dictum risus. Etiam tristique nisl a</p>
                            <h4>Sample Lorem Ipsum Text</h4>
                            <p>Sed eget turpis a pede tempor malesuada. Vivamus quis mi at leo pulvinar hendrerit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Pellentesque aliquet lacus vitae pede. Nullam mollis dolor ac nisi. Phasellus sit amet urna. Praesent pellentesque sapien sed lacus. Donec lacinia odio in odio. In sit amet elit. Maecenas gravida interdum urna. Integer pretium, arcu vitae imperdiet facilisis, elit tellus tempor nisi, vel feugiat ante velit sit amet mauris. Vivamus arcu. Integer pharetra magna ac lacus. Aliquam vitae sapien in nibh vehicula auctor. Suspendisse leo mauris, pulvinar sed, tempor et, consequat ac, lacus. Proin velit. Nulla semper lobortis mauris. Duis urna erat, ornare et, imperdiet eu, suscipit sit amet, massa. Nulla nulla nisi, pellentesque at, egestas quis, fringilla eu, diam.</p>
                        </div>
                        <div id="review" class="tab-pane">
                                <?php echo $this->smarty_insert_scripts(array('files'=>'transport.js,utils.js')); ?>
 <?php 
$k = array (
  'name' => 'comments',
  'type' => $this->_var['type'],
  'id' => $this->_var['id'],
);
echo $this->_echash . $k['name'] . '|' . serialize($k) . $this->_echash;
?>
                        </div>
                    </div>
                </div>
                <div class="product-related">
                    <div class="heading"><h2>关联产品</h2></div>
                    <div class="products">
                        <?php $_from = $this->_var['bought_goods']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'bought_goods_data');if (count($_from)):
    foreach ($_from AS $this->_var['bought_goods_data']):
?>
                        <div class="col-lg-4 col-md-4 col-xs-12">
                            <div class="product">
                                <div class="image"><a href="<?php echo $this->_var['bought_goods_data']['url']; ?>"><img src="<?php echo $this->_var['bought_goods_data']['goods_thumb']; ?>" alt="<?php echo $this->_var['bought_goods_data']['goods_name']; ?>"  class="goodsimg" /></a></div>
                                <div class="buttons">
                                    <a class="btn cart" href="#"><span class="glyphicon glyphicon-shopping-cart"></span></a>
                                    <a class="btn wishlist" href="#"><span class="glyphicon glyphicon-heart"></span></a>
                                    <a class="btn compare" href="#"><span class="glyphicon glyphicon-transfer"></span></a>
                                </div>
                                <div class="caption">
                                    <div class="name"><h3><a href="<?php echo $this->_var['bought_goods_data']['url']; ?>" title="<?php echo $this->_var['bought_goods_data']['goods_name']; ?>"><?php echo $this->_var['bought_goods_data']['short_name']; ?></a></h3></div>
                                    <div class="price"><?php echo $this->_var['bought_goods_data']['shop_price']; ?><span><?php echo $this->_var['bought_goods_data']['formated_promote_price']; ?></span></div>
                                    <div class="rating"><span class="glyphicon glyphicon-star"></span><span class="glyphicon glyphicon-star"></span><span class="glyphicon glyphicon-star"></span><span class="glyphicon glyphicon-star"></span><span class="glyphicon glyphicon-star-empty"></span></div>
                                </div>
                            </div>
                        </div>
                        <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
                    </div>
                    <div class="clear"></div>
                </div>
            </div>
            
        </div>
    </div>
</div>	
<?php echo $this->fetch('library/page_footer.lbi'); ?>